<template>
    <h1>登录成功</h1>
</template>

<script>
import { onMounted } from 'vue'
import { useRoute } from 'vue-router'

export default {
    name: "WxLoginCallback",
    setup() {
        const route = useRoute()

        onMounted(() => {
            let result = JSON.parse(route.query.result);
            console.log(result.data);
            console.log(result.accessToken);
            console.log(result.refreshToken);
            localStorage.setItem("user", JSON.stringify(result.data)); // 将登录成功的对象信息保存到本地储存中
            localStorage.setItem("access-token", result.accessToken); //保存token
            localStorage.setItem("refresh-token", result.refreshToken); //保存token
        })
    }
}
</script>

<style scoped></style>
